#include <iostream>
#include <stdio.h>
using namespace std;
const int MAXN=524288+233;
int ask[MAXN];
bool set[MAXN]={false};
int main() {
//	cout<<(1<<19)<<endl;   //524288
	cin.sync_with_stdio(false);
	int zz;
	int cnt=0;
	while (cin>>zz && zz!=-1) {
		ask[cnt++]=zz;
		set[zz]=true;
	}
	int res,cmp,tmp;
	for (int i=0; i<cnt; ++i) {
		res=0;
		for (int j=0; j<18; ++j) {
			zz=(1<<j);
			cmp=(ask[i]^zz);
			if (cmp>ask[i] && set[cmp]) ++res;
			for (int k=j+1; k<18; ++k) {
				tmp=(zz|(1<<k));
				cmp=(ask[i]^tmp);
				if (cmp>ask[i] && set[cmp]) ++res;
			}
		}
		cout<<ask[i]<<":"<<res<<endl;
	}
	return 0;
}
